-
Notifications
You must be signed in to change notification settings - Fork 274
feat: Add wrapper
option to render
#173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for sending the PR :) We're gonna have a look soon, hopefully tomorrow |
cc @Esemesek, mind taking a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments on the implementation to address. Please update the TypeScript definitions as well :)
src/render.js
Outdated
update: updateWithAct(renderer), | ||
rerender: updateWithAct(renderer), // alias for `update` | ||
update: updateWithAct(renderer, wrapUiIfNeeded), | ||
rerender: updateWithAct(renderer, wrapUiIfNeeded), // alias for `update` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update
and rerender
are wrapped with updateWithAct
twice now. One is enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't change that but just noticed that and you're right. I'll remove the ones up here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was reading it wrong. You want me to assign it to a const
so it's only called once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if this is what you had in mind...
Thanks :) I'll take a look. Are the TypeScript definitions written manually? |
Yep, we write them by hand. |
I'd appreciate another review on this. I'm not sure where to go with a couple of the comments. I thought they were just going to be quick fixes but as I dug into it again, I'm not sure the code can be simplified exactly as you proposed. I suggested a couple ideas. Thanks 😃 |
@Esemesek can you help out here please? :) |
I'm out for React Europe till the end of the week so it may take me some time to review properly again. |
wrapper
option to render
Awesome, thanks guys! So the obligatory follow up question, could we get this released sometime soon? 😃 Thanks for your work reviewing and cleaning it up and being open to PRs :) I had let Prettier attack those files so sorry for the reformatting needed. |
Thank you! It's gonna be released tomorrow morning as v1.8 :) |
Summary
Adds
wrapper
option to render function to allow users to specify a WrapperComponent that will be used by render, update, and rerender.Resolves #172
Test plan
Added tests. Tested
rerender
and notupdate
since it is an alias. Could test both or justupdate
instead...Notes
native-testing-library
https://github.com/testing-library/native-testing-library/blob/master/src/index.js#L16-L23. They are wrapping all tests inAppContainer
which I'm not sure why. Maybe to pick up yellow box errors?TestRenderer.create
. I initially tried spreading the rest out but couldn't get flow to cooperate.